<?php
namespace app\demo\controller;

use Env;
use think\Request;
use Session;
use Db;
use app\common\model\Feedback;
use Log;

class Index
{
    public function index(Request $request)
    {



        Log::error('这里是info信息');



        // 启动事务
        Db::startTrans();



        $logsInfo = [
            'username'=>'qiqi',
            'log'=>'edit'
        ];


        try {

            $edit = Db::table('qi_feedback')->where('id', 3)->update(['content' => '666667']);
            $logs = Db::table('qi_logs')->insert($logsInfo);

        }catch (\Exception $e) {
            // 回滚事务
            Db::rollback();
        }

        if($edit && $logs){
            Db::commit();
        }else{
            // 回滚事务
            Db::rollback();
        }


        dump($edit);
        dump($logs);

   }

       public function testModel(){
            $model = new Feedback();



            $data = $model->getInfoById(7);


        dump($data);

   }


   public function _empty(){
	   dump("hi this is a empty page!");
   }


}
